package com.jiaai.cloud.wx.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.jiaai.cloud.base.entity.RestResultGenerator;
import com.jiaai.cloud.base.exception.ServiceException;
import com.jiaai.cloud.base.page.CustomPage;
import com.jiaai.cloud.base.page.FrontPage;
import com.jiaai.cloud.wx.entity.TPay;
import com.jiaai.cloud.wx.entity.TPayVO;
import com.jiaai.cloud.wx.service.ITPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2017-08-28
 */
@Controller
@RequestMapping("/api/v1/tpay")
public class TPayController {

    @Autowired
    private ITPayService itPayService;

    //todo
    /**
     * 按时间段查询工资信息
     * @return
     * @throws ServiceException
     */
    @RequestMapping(value = "/querybytime",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"} )
    @ResponseBody
    public Object queryByTime(FrontPage frontPage, TPayVO tPayVO)  throws ServiceException {
        CustomPage<TPay> list = itPayService.selectPageName(frontPage.getPagePlus(), tPayVO);
        try {
            return RestResultGenerator.genSuccessResult(list);
        }catch (Exception e) {
            throw new ServiceException("查询失败", e.getMessage());
        }
    }



}
